#ifndef EMAILSERVICE
#define EMAILSERVICE

#include <curl/curl.h>
#include "runnable.hpp"
#include "datacollection.hpp"
//ftpenv is the curlenv
#include "ftpenv.hpp"
#include <vector>
#include <string>
#include "ftpprofiles.hpp"
#include "emailconfig.hpp"
#include <sstream>
using std::stringstream;
using std::string;
using std::vector;
using namespace com_oocl_monitor::domain;
using namespace com_oocl_monitor::system;
namespace com_oocl_monitor {
	namespace service {
		class EmailService :public Runnable {
		public:
			EmailService(EmailConfig emailConf, FtpInfo ftpInfo, Profile profile, DataCollection *_dataList = nullptr);
			virtual void run();
			virtual ~EmailService();
		private:
			string createMSG() const;
			static size_t payload_source(char *ptr, size_t size, size_t nmenb, void *usrp);
		private:
			CurlEnv *_curlEnv;
			EmailConfig _emailConfig;
			FtpInfo _ftpInfo;
			Profile _profile;
			DataCollection *_dataList;
		};
		typedef struct UserData {
			stringstream ss;
			size_t total;
			UserData() :total(0) {}
		}UserData;
	}
}

#endif // EMAILSERVICE

